<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>flex-wrap 控制是否换行</title>
        <style>
            h1 {
                font: bold 20px/1.5 georgia, simsun, sans-serif;
            }
            .box {
                display: -webkit-flex;
                display: flex;
                width: 220px;
                margin: 0;
                padding: 10px;
                list-style: none;
                background-color: pink;
            }
            .box li {
                width: 100px;
                height: 100px;
                border: 1px solid #aaa;
                background-color: #fff;
                text-align: center;
            }
            #box {
                -webkit-flex-wrap: nowrap;
                /* 默认值。flex容器为单行。不换行，则子盒子收缩（压缩）显示强制一行内显示。该情况下flex子项可能会溢出容器 */
                flex-wrap: nowrap;
            }
            #box2 {
                -webkit-flex-wrap: wrap;
                /* flex容器为多行。该情况下flex子项溢出的部分会被放置到新行，子项内部会发生断行 */
                flex-wrap: wrap;
            }
            #box3 {
                -webkit-flex-wrap: wrap-reverse;
                /* flex容器为多行。盒子的顺序将反转 */
                flex-wrap: wrap-reverse;
            }
        </style>
    </head>
    <body>
        <h1>flex-wrap示例：</h1>
        <h2>flex-wrap:nowrap</h2>
        <p>flex容器为单行。该情况下flex子项可能会溢出容器</p>
        <ul id="box" class="box">
            <li>a</li>
            <li>b</li>
            <li>c</li>
        </ul>
        <h2>flex-wrap:wrap</h2>
        <p>
            flex容器为多行。该情况下flex子项溢出的部分会被放置到新行，子项内部会发生断行
        </p>
        <ul id="box2" class="box">
            <li>a</li>
            <li>b</li>
            <li>c</li>
        </ul>
        <h2>flex-wrap:wrap-reverse</h2>
        <p>flex容器为多行。子项排列反转</p>
        <ul id="box3" class="box">
            <li>a</li>
            <li>b</li>
            <li>c</li>
        </ul>
    </body>
</html>
